package cn.com.dycc.party_org.membership.controller;

import java.util.List;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import cn.com.dycc.common.controller.BaseController;
import cn.com.dycc.party_org.membership.entity.MemberShipEntity;
import cn.com.dycc.party_org.membership.param.AddMemberShipParam;
import cn.com.dycc.party_org.membership.service.MemberShipService;
import cn.com.dycc.util.JsonObjectResult;

@Controller
@RequestMapping("/mebship")
public class MemberShipController extends BaseController{
	
	@Resource(name="memberShipService")
	private MemberShipService memberShipService;
	
	//增加党籍信息
	@RequestMapping("/add.do")
	@ResponseBody
	public JsonObjectResult addMemberShip(HttpServletRequest request,AddMemberShipParam addMemberShipParam){
		String mes = memberShipService.addMemberShip(request, addMemberShipParam);
		return new JsonObjectResult(mes);
	}
	
	//删除党籍信息
	@RequestMapping("/delmembership.do")
	@ResponseBody
	public JsonObjectResult delMemberShipByInfoId(HttpServletRequest request,String info_id){
		String mes = memberShipService.delMemberShipByInfoId(request,info_id);
		return new JsonObjectResult(mes);
	}
	
	//查询该党员用户的所有党籍变化信息
	@RequestMapping("/findlist.do")
	@ResponseBody
	public JsonObjectResult findMemberShipList(HttpServletRequest request,String user_id){
		List<MemberShipEntity> list = memberShipService.findMemberShipList(request, user_id);
		return new JsonObjectResult(String.valueOf(list.size()),list);
	}

}
